package com.itheima.demo;

import java.util.TreeSet;

public class Demo {

    public static void main(String[] args) {

        Student s1 = new Student("耳根",39);
        Student s2 = new Student("辰东",33);
        Student s3 = new Student("忘语",41);
        Student s4 = new Student("番茄",39);

        TreeSet<Student> treeSet = new TreeSet<>();

        treeSet.add(s1);
        treeSet.add(s2);
        treeSet.add(s3);
        treeSet.add(s4);

        treeSet.forEach(student -> System.out.println(student.getName()+"----"+student.getAge()));
    }
}
